import java.util.Arrays;
import java.util.Scanner;

public class Demo9 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = i + 1;
        }

        while (m > 0) {
            m--;
            int method = scan.nextInt(); // 0 或 1
            int index = scan.nextInt();
            if (method == 0) { // 0 - index 降序
                Arrays.sort(arr, 0, index);
                desc(arr, 0, index);
            } else {
                Arrays.sort(arr, index - 1, n);
            }
            System.out.println(Arrays.toString(arr));
        }

        for (int i : arr) {
            System.out.print(i + " ");
        }

        scan.close();
    }

    //逆序数组中的一部分
    private static void desc(int[] arr, int start, int end) {
        int left = start, right = end - 1;
        while (left < right) {
            int temp = arr[left];
            arr[left] = arr[right];
            arr[right] = temp;
            left++;
            right--;
        }
    }
}
